Skip to content

fix: improve sample error messaging - #1606

Merged
ChongJiaChua merged 2 commits into
developfrom
1378_Generic_Templates_Validation_Errors
Jun 26, 2026
Merged

fix: improve sample error messaging#1606
ChongJiaChua merged 2 commits into
developfrom
1378_Generic_Templates_Validation_Errors

Conversation

@ChongJiaChua

@ChongJiaChua ChongJiaChua commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #1378

Description

This PR improves validation feedback for generic templates on proposal sample pages. When one or more sample entries are incomplete or contain answers that violate constraints, the parent page now lists the affected sample names instead of showing the generic "All genericTemplates must be completed" message.

Motivation and Context

Users could save draft progress in a generic template with an answer that violated constraints, such as text longer than the configured character limit. This draft save is allowed, but when they later tried to continue from the parent Samples page, they only saw the ambiguous error "All genericTemplates must be completed".

How Has This Been Tested

Added e2e tests.

Fixes

Changes

  1. Updated the error message to list the affected sample(s).
  2. Shows exact validation errors when reopening an invalid saved sample.
  3. Changed incomplete generic-template list entries to use a warning icon instead of a red document icon.

Depends on

Tests included/Docs Updated?

  • I have added tests to cover my changes.
  • All relevant doc has been updated

@ChongJiaChua
ChongJiaChua marked this pull request as ready for review June 25, 2026 10:53
@ChongJiaChua
ChongJiaChua requested a review from a team as a code owner June 25, 2026 10:53
@ChongJiaChua
ChongJiaChua requested review from ellen-wright and removed request for a team June 25, 2026 10:53
@ChongJiaChua ChongJiaChua changed the title fix: improve error messaging by giving clearer instructions fix: improve sample error messaging Jun 25, 2026
@ChongJiaChua ChongJiaChua self-assigned this Jun 25, 2026
@ChongJiaChua ChongJiaChua changed the title fix: improve sample error messaging fix: improve sample error messaging Jun 25, 2026
Comment on lines +26 to +29
.map((genericTemplate) => genericTemplate.title || 'Untitled sample')
.join(', ');

return `The following sample(s) are violating constraints: ${genericTemplateTitles}. Fix the red sections and click "Save and continue" in each sample before continuing.`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it'd work for the samples case in the issue, but generic templates can be used for other things in the questionnaires too, so I don't think we should be hardcoding the text to be about samples.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that's a good point. I've updated the message to be generic rather than specific to samples.

@ChongJiaChua
ChongJiaChua merged commit bc36df0 into develop Jun 26, 2026
21 checks passed
@ChongJiaChua
ChongJiaChua deleted the 1378_Generic_Templates_Validation_Errors branch June 26, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generic templates validation error

2 participants